{{ $api := site.Data.docs.api }}
{{ $endpoints := $api.endpoints }}
{{ $colors := dict "GET" "text-green-500" "POST" "text-indigo-400" }}
<div class="no-prose flex flex-col divide-y dark:divide-gray-700 border dark:border-gray-700 rounded-md">
  {{ range $path, $info := $endpoints }}
  {{ range $method, $v := $info }}
  {{ $color := index $colors $method }}
  {{ $id := printf "%s %s" $method $path | urlize | replaceRE "/" "" }}
  <div class="py-4 px-6">
    <div class="flex space-x-3 font-mono">
      <h3 class="js-toc-ignore" id="{{ $id }}">
        <span class="{{ $color }} text-xl font-extrabold tracking-wide">
          {{- $method -}}
        </span>

        <span class="text-xl font-semibold">
          {{- $path -}}
        </span>
      </h3>
    </div>

    {{ with $v.description }}
    <div class="mt-5 leading-tight prose-md">
      {{ . | markdownify }}
    </div>
    {{ end }}

    {{ with $v.responses }}
    <div class="mt-3">
      <h4 class="js-toc-ignore font-bold">
        Responses
      </h4>

      <div class="mt-2 grid grid-cols-5 border-b-2 dark:border-gray-700 pb-1 tracking-tight font-semibold">
        <div class="col-span-1">
          Code
        </div>

        <div class="col-span-4">
          Description
        </div>
      </div>

      <div class="pt-1">
        {{ range $code, $v := . }}
        <div class="grid grid-cols-5">
          <div class="col-span-1">
            <span class="font-mono text-purple-v font-bold">
              {{ $code }}
            </span>
          </div>

          <div class="col-span-4 prose-sm">
            {{ $v.description | markdownify }}
          </div>
        </div>
      {{ end }}
      </div>
    </div>
    {{ end }}
  </div>
  {{ end }}
  {{ end }}
</div>

